Conversation
Move all deletion tests to the end of the test suite to prevent cascading failures. Previously, deletion tests were interspersed throughout, causing subsequent tests to fail when trying to access deleted resources (playlists, rundowns, segments, parts). Also add null check for newIngestPart before accessing its properties.
WalkthroughTest file refactoring that consolidates deletion-related tests into a dedicated block at the end of the test suite and adds a defensive guard check to verify object existence before mutation during part updates. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/openapi/src/__tests__/ingest.spec.ts (1)
356-388:newIngestPartmutation is unused — theputPartcall uses a hardcoded literal.The guard at lines 358-360 is a good defensive addition, but note that
newIngestPart.nameis mutated and then never referenced again — the API call on line 361 passes a hardcoded part object (externalId: 'part1',name: 'Part 1', etc.), notnewIngestPart. This makes the entireifblock dead code. Was the intent to passnewIngestPart(or its modified name) into theputPartcall?🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/openapi/src/__tests__/ingest.spec.ts` around lines 356 - 388, The test contains dead code: the conditional mutates newIngestPart.name but the ingestApi.putPart call passes a hardcoded part object, so the mutation is never used; either remove the unused if-block or change the putPart invocation in the 'Can update a part' test to pass the modified newIngestPart (or a copy with the updated name) as the part parameter instead of the hardcoded literal; update references to newIngestPart and ingestApi.putPart accordingly so the mutated name is actually sent to the API.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/openapi/src/__tests__/ingest.spec.ts`:
- Around line 356-388: The test contains dead code: the conditional mutates
newIngestPart.name but the ingestApi.putPart call passes a hardcoded part
object, so the mutation is never used; either remove the unused if-block or
change the putPart invocation in the 'Can update a part' test to pass the
modified newIngestPart (or a copy with the updated name) as the part parameter
instead of the hardcoded literal; update references to newIngestPart and
ingestApi.putPart accordingly so the mutated name is actually sent to the API.
|



About the Contributor
Type of Contribution
This is a Bug fix
Current Behavior
mainis failing CI.New Behavior
Fix
main.Move all deletion tests to the end of the test suite to prevent cascading failures. Previously, deletion tests were interspersed throughout, causing subsequent tests to fail when trying to access deleted resources (playlists, rundowns, segments, parts).
Also add null check for newIngestPart before accessing its properties.
Testing
Affected areas
Time Frame
Other Information
Status
Summary
This PR reorders the OpenAPI ingest test suite to prevent test failures caused by later tests attempting to access resources that have been deleted. All deletion-related tests (for playlists, rundowns, segments, and parts) have been moved to a consolidated section at the end of the test file. Additionally, a null check has been added to guard against accessing properties on
newIngestPartbefore it's validated.Changes
File:
packages/openapi/src/__tests__/ingest.spec.tsConsolidated all deletion tests into a single "DELETIONS" block at the end of the test suite, including:
Added a null/undefined check for
newIngestPartbefore accessing its properties during part update operationsTest semantics and expected outcomes remain unchanged; only execution order has been modified
Statistics